export default {
    bind: function(el, binding) {
        el.$copy = function() {
          const textarea = document.createElement('textarea');
          textarea.value = binding.value;
          document.body.appendChild(textarea);
          textarea.select();
          document.execCommand('Copy');
          document.body.removeChild(textarea);
                alert('已复制到剪贴板！');
        }
        el.addEventListener('click', el.$copy);
      },
      unbind: function(el) {
        el.removeEventListener('click', el.$copy);
      }
}